home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
unixSyscall
/
RCS
/
writev.c,v
< prev
Wrap
Text File
|
1991-12-10
|
3KB
|
129 lines
head 1.2;
branch ;
access ;
symbols sprited:1.2.1;
locks ; strict;
comment @ * @;
1.2
date 90.08.20.17.18.43; author kupfer; state Exp;
branches 1.2.1.1;
next 1.1;
1.1
date 88.06.19.14.32.14; author ouster; state Exp;
branches ;
next ;
1.2.1.1
date 91.12.10.16.44.55; author kupfer; state Exp;
branches ;
next ;
desc
@@
1.2
log
@Don't return error status if write partially succeeded.
@
text
@/*
* writev.c --
*
* Procedure to map from Unix writev system call to Sprite.
*
* Copyright 1986 Regents of the University of California
* All rights reserved.
*/
#ifndef lint
static char rcsid[] = "$Header: /sprite/src/lib/c/unixSyscall/RCS/writev.c,v 1.1 88/06/19 14:32:14 ouster Exp Locker: kupfer $ SPRITE (Berkeley)";
#endif not lint
#include "sprite.h"
#include "fs.h"
#include "compatInt.h"
#include <sys/types.h>
#include <sys/uio.h>
/*
*----------------------------------------------------------------------
*
* writev --
*
* Procedure to map from Unix writev system call to Sprite Fs_Write.
*
* Results:
* UNIX_ERROR is returned upon error, with the actual error code
* stored in errno. Upon success, the number of bytes actually
* written is returned.
*
* Side effects:
* The data in the buffers is written to the file at the indicated offset.
*
*----------------------------------------------------------------------
*/
int
writev(descriptor, iov, ioveclen)
int descriptor; /* descriptor for stream to write */
register struct iovec *iov; /* array of io vectors. */
int ioveclen; /* number of iovec's in iov. */
{
ReturnStatus status; /* result returned by Fs_Write */
int amountWritten; /* place to hold number of bytes written */
int totalWritten = 0; /* place to hold total # of bytes written */
int i;
for (i=0; i < ioveclen; i++, iov++) {
status = Fs_Write(descriptor, iov->iov_len, iov->iov_base,
&amountWritten);
if (status != SUCCESS) {
break;
} else {
totalWritten += amountWritten;
}
}
if (status != SUCCESS && totalWritten == 0) {
errno = Compat_MapCode(status);
return(UNIX_ERROR);
} else {
return(totalWritten);
}
}
@
1.2.1.1
log
@Initial branch for Sprite server.
@
text
@d11 1
a11 1
static char rcsid[] = "$Header: /sprite/src/lib/c/unixSyscall/RCS/writev.c,v 1.2 90/08/20 17:18:43 kupfer Exp $ SPRITE (Berkeley)";
@
1.1
log
@Initial revision
@
text
@d11 1
a11 1
static char rcsid[] = "$Header: writev.c,v 1.1 87/06/18 18:41:21 andrew Exp $ SPRITE (Berkeley)";
d35 1
a35 1
* The data in the buffer is written to the file at the indicated offset.
d60 1
a60 1
if (status != SUCCESS) {
@